﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YJKWndrStatisticsExcel.AreaTable.StatisticControler;

namespace YJKWndrStatisticsExcel.AreaTable.Forms
{
	public partial class HouseSuiteAreaAnalyzeForm : System.Windows.Forms.Form
	{
		public HouseSuiteAreaAnalyzeForm(List<HouseSuiteAreaAnalyzeData> data)
		{
			this.m_Data = data;
			this.InitializeComponent();
		}

		private void StatisticalResultForm_Load(object sender, EventArgs e)
		{
			this.AddItems();
		}

		private void AddItems()
		{
			System.Drawing.Color lightGray = System.Drawing.Color.LightGray;
			System.Drawing.Color lightGray2 = System.Drawing.Color.LightGray;
			this.treeListView.Sorting = SortOrder.None;
			for (int i = 0; i < this.m_Data.Count; i++)
			{
				HouseSuiteAreaAnalyzeData houseSuiteAreaAnalyzeData = this.m_Data[i];
				TreeListViewItem parent = TreeListViewEditor.AddRootItem(houseSuiteAreaAnalyzeData.m_StatisticalRange, 0, this.treeListView);
				for (int j = 0; j < houseSuiteAreaAnalyzeData.m_Data.Count; j++)
				{
					HouseSuiteAreaAnalyzeListBySuite houseSuiteAreaAnalyzeListBySuite = houseSuiteAreaAnalyzeData.m_Data[j];
					TreeListViewItem parent2 = TreeListViewEditor.AddItem(houseSuiteAreaAnalyzeListBySuite.m_SuiteName, 0, parent);
					for (int k = 0; k < houseSuiteAreaAnalyzeListBySuite.m_Data.Count; k++)
					{
						HouseSuiteAreaAnalyzeRowData houseSuiteAreaAnalyzeRowData = houseSuiteAreaAnalyzeListBySuite.m_Data[k];
						TreeListViewItem parent3 = TreeListViewEditor.AddItem(houseSuiteAreaAnalyzeRowData.m_SuiteNumbName, 1, parent2);
						TreeListViewEditor.AddColumnItems(houseSuiteAreaAnalyzeRowData.ToStrList(), 1, parent3, lightGray);
					}
					TreeListViewItem parent4 = TreeListViewEditor.AddItem("合计", 1, parent2);
					TreeListViewEditor.AddColumnItems(houseSuiteAreaAnalyzeListBySuite.m_Footing.ToStrList(), 1, parent4, lightGray2);
				}
				TreeListViewItem parent5 = TreeListViewEditor.AddItem("合计", 1, parent);
				TreeListViewEditor.AddColumnItems(houseSuiteAreaAnalyzeData.m_SumFooting.ToStrList(), 1, parent5, lightGray2);
			}
		}

		private List<HouseSuiteAreaAnalyzeData> m_Data;
	}
}
